/**
 * Copyright (C) 2021 - 2031 O-Cubes Co., Ltd.
 */

/****************************************************************
 *  @file    testcase.c
 *  @brief   Test case source file
 *  @version v1.0
 *  @date    03. Apr. 2023
 ****************************************************************/

#include "testcase.h"
#include "printf.h"
#include "common.h"

typedef int32_t (*tc_func_t)(void);

static const tc_func_t g_tc_sequence[] =
{

#ifdef CONFIG_SDK_UART_TEST
	test_uartx,
#endif
#ifdef CONFIG_SDK_GPIO_TEST
	test_gpio,
#endif
#ifdef CONFIG_SDK_SYSCOUNTER_TEST
	test_syscounter,
#endif
#ifdef CONFIG_SDK_MTIMER_TEST
	test_mtimer,
#endif
#ifdef CONFIG_SDK_RTC_TEST
	test_rtc,
#endif
#ifdef CONFIG_SDK_INT_NEST_TEST
	test_int_nest,
#endif
#ifdef CONFIG_SDK_TIMER_TEST
	test_timer,
#endif
#ifdef CONFIG_SDK_DMA_TEST
	test_dma,
#endif
#ifdef CONFIG_SDK_PWM_TEST
	test_pwm,
#endif
#ifdef CONFIG_SDK_I2C_TEST
	test_i2c,
#endif
#ifdef CONFIG_SDK_SPI_TEST
	test_spi0_lcd,
#endif
#ifdef CONFIG_SDK_SEC_TEST
	test_security,
#endif
#ifdef CONFIG_SDK_SPI_FLASH_TEST
	test_spi_flash,
#endif
#ifdef CONFIG_SDK_SPI_SLAVE_TEST
	test_spi_slave,
#endif
#ifdef CONFIG_SDK_MONITOR_TEST
	test_monitor,
#endif
#ifdef CONFIG_SDK_TSENSOR_TEST
	test_tsensor,
#endif
#ifdef CONFIG_SDK_ISP_TEST
	test_isp,
#endif
#ifdef CONFIG_SDK_SARADC_TEST
	test_saradc,
#endif
#ifdef CONFIG_SDK_I2C_DMA_TEST
	test_i2c_dma,
#endif
#ifdef CONFIG_SDK_SPI_DMA_TEST
	test_spi_dma,
#endif
#ifdef CONFIG_SDK_UART_DMA_TEST
	test_uart_dma,
#endif
#ifdef CONFIG_SDK_SPI_SLAVE_DMA_TEST
	test_spi_slave_dma,
#endif

#if 0
#ifdef CONFIG_SDK_PMU_TEST
	test_pmu,
#endif
#ifdef CONFIG_SDK_EFUSE_TEST
	test_efuse,
#endif
#ifdef CONFIG_SDK_WDT_TEST
	test_wdt,
#endif
#endif
	NULL,
};

void run(void)
{
	const tc_func_t *func = NULL;
	int ret;

	printf("\n**** TESTCASE RUN ****\r\n");

	for (func = g_tc_sequence; *func; ++func) {
		ret = (*func)();

		if (ret)
			break;
	}

	printf("\n**** TESTCASE END ****\r\n");
}

